<?php include_once './header.php'; ?>

<?php 
include('config.php'); 
if (isset($_GET['idCurso']) ) { 
$idCurso = (int) $_GET['idCurso']; 

if (isset($_POST['submitted'])) { 
/*foreach($_POST AS $key => $value) { $_POST[$key] = mysql_real_escape_string($value); } 
$sql = "UPDATE `serviciosadicionales` SET  `nombreServicio` =  '{$_POST['nombreServicio']}' ,  `descServicio` =  '{$_POST['descServicio']}' ,  `urlServicio` =  '{$_POST['urlServicio']}' ,  `precioServicio` =  '{$_POST['precioServicio']}' ,  `gratuito` =  '{$_POST['gratuito']}' ,  `periodicidad` =  '{$_POST['periodicidad']}'   WHERE `idServicio` = '$idServicio' "; 
mysql_query($sql) or die(mysql_error()); 
echo (mysql_affected_rows()) ? "Edited row.<br />" : "Nothing changed. <br />"; 
echo "<a href='listServices.php'>Back To Listing</a>"; */
} 
//$row = mysql_fetch_array ( mysql_query("SELECT * FROM `serviciosadicionales` WHERE `idCurso` = '$idCurso' ")); 
$row = mysql_fetch_array ( mysql_query("SELECT curs.idCurso, curs.nombreCurso, 
MAX(if(1=prec.idsemanasp,prec.precioCurso, null))'semana1',
MAX(if(2=prec.idsemanasp,prec.precioCurso, null))'semana2',
MAX(if(3=prec.idsemanasp,prec.precioCurso, null))'semana3',
MAX(if(4=prec.idsemanasp,prec.precioCurso, null))'semana4',
MAX(if(5=prec.idsemanasp,prec.precioCurso, null))'semana5',
MAX(if(6=prec.idsemanasp,prec.precioCurso, null))'semana6',
MAX(if(7=prec.idsemanasp,prec.precioCurso, null))'semana7',
MAX(if(8=prec.idsemanasp,prec.precioCurso, null))'semana8',
MAX(if(9=prec.idsemanasp,prec.precioCurso, null))'semana9',
MAX(if(10=prec.idsemanasp,prec.precioCurso, null))'semana10',
MAX(if(11=prec.idsemanasp,prec.precioCurso, null))'semana11',
MAX(if(12=prec.idsemanasp,prec.precioCurso, null))'semana12',
MAX(if(13=prec.idsemanasp,prec.precioCurso, null))'semana13',
MAX(if(14=prec.idsemanasp,prec.precioCurso, null))'semana14',
MAX(if(15=prec.idsemanasp,prec.precioCurso, null))'semana15',
MAX(if(16=prec.idsemanasp,prec.precioCurso, null))'semana16',
MAX(if(17=prec.idsemanasp,prec.precioCurso, null))'semana17',
MAX(if(18=prec.idsemanasp,prec.precioCurso, null))'semana18',
MAX(if(19=prec.idsemanasp,prec.precioCurso, null))'semana19',
MAX(if(20=prec.idsemanasp,prec.precioCurso, null))'semana20',
MAX(if(21=prec.idsemanasp,prec.precioCurso, null))'semana21',
MAX(if(22=prec.idsemanasp,prec.precioCurso, null))'semana22',
MAX(if(23=prec.idsemanasp,prec.precioCurso, null))'semana23',
MAX(if(24=prec.idsemanasp,prec.precioCurso, null))'semana24'
FROM cursos curs, precios prec
Where prec.idcursop=curs.idcurso and curs.idcurso = '$idCurso' 
group by curs.idCurso
order by 1")); 
?>

<form action='' method='POST'> 
<p><b>Curso</b><br />				<input type='text' name='nombreCurso' value='<?= stripslashes($row['nombreCurso']) ?>' /> 

<p><b>Precio 1 Sem</b><br />    	<input type='text' name='sem1'		 value='<?= stripslashes($row['semana1']) ?>' /> 
<p><b>Precio 2 Sem</b><br /> 		<input type='text' name='sem2'		 value='<?= stripslashes($row['semana2']) ?>' /> 
<p><b>Precio 3 Sem</b><br />       	<input type='text' name='sem3' 		 value='<?= stripslashes($row['semana3']) ?>' /> 
<p><b>Precio 4 Sem</b><br />   		<input type='text' name='sem4' 		 value='<?= stripslashes($row['semana4']) ?>' /> 
<p><b>Precio 5 Sem</b><br />   		<input type='text' name='sem5' 		 value='<?= stripslashes($row['semana5']) ?>' /> 
<p><b>Precio 6 Sem</b><br />   		<input type='text' name='sem6' 		 value='<?= stripslashes($row['semana6']) ?>' /> 
<p><b>Precio 7 Sem</b><br />    	<input type='text' name='sem7'		 value='<?= stripslashes($row['semana7']) ?>' /> 
<p><b>Precio 8 Sem</b><br /> 		<input type='text' name='sem8'		 value='<?= stripslashes($row['semana8']) ?>' /> 
<p><b>Precio 9 Sem</b><br />       	<input type='text' name='sem9' 		 value='<?= stripslashes($row['semana9']) ?>' /> 
<p><b>Precio 10 Sem</b><br />   	<input type='text' name='sem10'		 value='<?= stripslashes($row['semana10']) ?>' /> 
<p><b>Precio 11 Sem</b><br />   	<input type='text' name='sem11'		 value='<?= stripslashes($row['semana11']) ?>' /> 
<p><b>Precio 12 Sem</b><br />   	<input type='text' name='sem12'		 value='<?= stripslashes($row['semana12']) ?>' /> 
<p><b>Precio 13 Sem</b><br />    	<input type='text' name='sem13'		 value='<?= stripslashes($row['semana13']) ?>' /> 
<p><b>Precio 14 Sem</b><br /> 		<input type='text' name='sem14'		 value='<?= stripslashes($row['semana14']) ?>' /> 
<p><b>Precio 15 Sem</b><br />       <input type='text' name='sem15'		 value='<?= stripslashes($row['semana15']) ?>' /> 
<p><b>Precio 16 Sem</b><br />   	<input type='text' name='sem16'		 value='<?= stripslashes($row['semana16']) ?>' /> 
<p><b>Precio 17 Sem</b><br />   	<input type='text' name='sem17'		 value='<?= stripslashes($row['semana17']) ?>' /> 
<p><b>Precio 18 Sem</b><br />   	<input type='text' name='sem18'		 value='<?= stripslashes($row['semana18']) ?>' /> 
<p><b>Precio 19 Sem</b><br />    	<input type='text' name='sem19'		 value='<?= stripslashes($row['semana19']) ?>' /> 
<p><b>Precio 20 Sem</b><br /> 		<input type='text' name='sem20'		 value='<?= stripslashes($row['semana20']) ?>' /> 
<p><b>Precio 21 Sem</b><br />       <input type='text' name='sem21'		 value='<?= stripslashes($row['semana21']) ?>' /> 
<p><b>Precio 22 Sem</b><br />   	<input type='text' name='sem22'		 value='<?= stripslashes($row['semana22']) ?>' /> 
<p><b>Precio 23 Sem</b><br />   	<input type='text' name='sem23'		 value='<?= stripslashes($row['semana23']) ?>' /> 
<p><b>Precio 24 Sem</b><br />   	<input type='text' name='sem24'		 value='<?= stripslashes($row['semana24']) ?>' /> 


<p><input type='submit' value='Edit Row' /><input type='hidden' value='1' name='submitted' /> 
</form> 
<?php } ?> 

<?php include_once './footer.php'; ?>